package com.kongjs.modules.monitor.controller;

import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

@RestController
@RequestMapping("/monitor")
public class MonitorController {
    @GetMapping(path="/streams", produces= MediaType.TEXT_EVENT_STREAM_VALUE)
    public SseEmitter streams() {
        SseEmitter emitter = new SseEmitter();
        emitter.complete();
        emitter.completeWithError(null);
        return emitter;
    }
}
